<template>
    <div>
        <h1>注册登录</h1>
        <table class="table">
            <thead>
                <tr>
                    <td>用户名</td>
                    <td>
                        <input type="text" v-model="data.Dname">
                    </td>
                </tr>
                <tr>
                    <td>用户密码</td>
                    <td>
                        <input type="password" v-model="data.Dmima">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="注册" @click="add">
                    </td>
                </tr>
            </thead>
        </table>
    </div>
    <a href="/denglu">登录</a>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
//实例化
const router=useRouter();
//注册N
const data=ref({
  "DId": 0,
  "Dname": "",
  "Dmima": ""
});
const add=()=>{
    axios.post("https://localhost:7293/api/Fhall/Zhuce",data.value).then(res=>{
        if(res.data>0)
        {
            alert("注册成功");
            router.push({path:"/"});
        }
        else
        {
            alert("注册失败");
        }
    })
}


</script>

<style scoped>

</style>